package role

import (
	"context"

	"jinrigaoping/api/superadmin/internal/svc"
	"jinrigaoping/api/superadmin/internal/types"
	"jinrigaoping/rpc/sys/sys"

	"github.com/zeromicro/go-zero/core/logx"
)

type RoleUpdateLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewRoleUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RoleUpdateLogic {
	return &RoleUpdateLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *RoleUpdateLogic) RoleUpdate(req *types.SysRoleUpdateReq) (resp *types.SysRoleUpdateRes, err error) {

	l.svcCtx.SysRpc.SysRoleUpdate(l.ctx, &sys.SysRoleUpdateReq{
		Id:         req.Id,
		RoleName:   req.RoleName,
		Remark:     req.Remark,
		MenuIdList: req.MenuIdList,
	})

	return &types.SysRoleUpdateRes{}, nil
}
